<%@page language="java" import="com.scalar.chiptrack.utils.ConfigManager"%>

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>

<chiptrack:checkLogon sourcePage="/lotCreation.do"/>

<%String chipTracContext = "/" + ConfigManager.getChipTracContext();%>

<HTML><HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type=text/css rel=stylesheet>

<META content="MSHTML 5.50.4807.2300" name=GENERATOR>
<SCRIPT language="JavaScript1.2">
   
	function selectPartNumber()
{
	document.lotCreation.action.value='product';
	document.lotCreation.submit();
}



    function submitPage(action)
    {
        var pa=document.getElementById("message");
        var x = document.lotCreation.locationName;
        
        for(var i=0; i<x.length; i++){
	    	if(x.options[i].selected){
	    		if(x.options[i].value == "Select Location Name"){
	    			pa.innerHTML = "Select The Location Name";
	    			return;
	    		}
	    	}
    	}
    	
    	x = document.lotCreation.productName;
    	for(var i=0; i<x.length; i++){
	    	if(x.options[i].selected){
	    		if(x.options[i].value == "Select Product Name"){
	    			pa.innerHTML = "Select Product Name";
	    			return;
	    		}
	    	}
	    }
	    if(document.lotCreation.lotNo.value == ""){
	    	pa.innerHTML = "Enter Lot Number";
	    	return;
	    }
	    if(document.lotCreation.vendorLotNo.value == ""){
	    	pa.innerHTML = "Enter Vendor Lot #";
	    	return;
	    }
	   	if(document.lotCreation.dateIn.value == ""){
	    	pa.innerHTML = "Enter Date In";
	    	return;
	    }
	    
        if(action == 'UPDATE')
            document.lotCreation.action.value = "Update";
        else if(action == 'SAVE')
            document.lotCreation.action.value = "SAVE";
            
        document.lotCreation.submit();
    }
    
</SCRIPT>
</HEAD>
<BODY bgColor=#ffffff leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">

<!-- Top Header Start-->

<%@ include file="/jsp/includes/header.jsp" %>

<!-- Top Header End-->

<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TBODY>
  <TR>
	<TD width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>

<!-- Side Navigation start -->
	<%@ include file="/jsp/operations/dataentryMenu.jsp" %>
</TD>
<!-- end of the side navigations -->
<TD bgcolor="#ffffff">
<IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></TD>
<TD bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></TD>
<TD valign="top" width="100%">

<IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>

<BR>
<!-- from here your body starts -->
<html:form name="lotCreation"  type="com.scalar.chiptrack.operations.dataentry.forms.LotCreationForm" action="/lotCreation.do">
	<center>
		<span class="NArialW">Lot Creation</span>
	</center>
	<p>&nbsp;
	<img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20>
	<center>
	<strong><font face="Verdana" size="-5" align="center" color="#ff0000" id="message"></font>
	</center>
<%
	String action = (String)request.getAttribute("action");
	if(action==null)
	action="";
	
	String message = (String)request.getAttribute("errorMessage");
   	if(message==null)
   		message=""; 
%>
<%
 	if(!message.equals("")){
%>	
	<!--<p align ="center">
	 <strong><font face="Verdana" size="-5" align="center" color="#ff0000"><b><%=message%></b></font>
    </p> -->
    <SCRIPT language="JavaScript1.2">
    	var pa=document.getElementById("message");
    	pa.innerHTML = "<%= message%>";
    </SCRIPT>
<%
 	} 
 %>

	</p>

	<table border="0" width="90%" align=right>
  	<tr>
    	<td width="20%"><font class="NArialL">Purchase Order#</font></td>
    	<td width="25%"><p><font class="NArialL">
			<html:text name="lotCreationForm" property="purchaseOrderNo" size="17" styleClass="txfield" />
    		</font></p>
      	</td>
    	<td width="20%"><font class="NArialL">Product Name</font></td>
    	<td width="20%" align=left><font class="NArialL">
		<html:select name="lotCreationForm" size="1" property="productName" onchange="selectPartNumber()" styleClass="txfield">
    		<html:option value="Select Product Name" />
        	<html:options collection="pList" property="value" labelProperty= "label"  />
      	</html:select></font>
    	<td width="7%">&nbsp;</td>
  	</tr>
	<% if(action.equalsIgnoreCase("product") || action.equalsIgnoreCase("save")){ %>
  	<tr>
    	<td width="20%"><font class="NArialL">Location</font></td>
    	<td width="25%"><font class="NArialL">
    	<html:select name="lotCreationForm" size="1" property="locationName" styleClass="txfield">
    		<html:option value="Select Location Name"/>
        	<html:options collection="fabLocationList" property="value" labelProperty= "label"  />
      	</html:select></font>
    </td>
    <td width="20%"><font class="NArialL">Vendor Lot#</font></td>
    <td width="20%"><html:text name="lotCreationForm" property="vendorLotNo" size="16" styleClass="txfield" /></td>
    <td width="7%">&nbsp;</td>
  </tr>
  <tr>
    <td width="20%"><font class="NArialL">Lot Number</font></td>
    <td width="25%"><html:text name="lotCreationForm" property="lotNo" size="17" styleClass="txfield" /></td>
    <td width="20%"><font class="NArialL">Date In</font></td>
    <td width="20%"><html:text name="lotCreationForm" property="dateIn" size="16" styleClass="txfield" /></td>
    <td width="7%">&nbsp;</td>
  </tr>
  <tr>
    <td width="20%"><font class="NArialL">Input Qty (# of wafers)</font></td>
    <td width="25%"><html:text name="lotCreationForm" property="quantity" size="17" styleClass="txfield" /></td>
    <td width="20%"><font class="NArialL">Created By</font></td>
    <td width="20%"><html:text name="lotCreationForm" property="createdBy" size="16" styleClass="txfield" /></td>
    <td width="7%">&nbsp;</td>
  </tr>
   <tr><td colspan=5><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20></td></tr>
    <tr><td colspan=4 align=center>
    <a href="javascript:submitPage('SAVE')"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/save.gif" width="53" height="17"></a>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <a href="#"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/cancel.gif" width="53" height="17"></a>
  </td></tr>
  <%}%>
</table>

<input type="hidden" name="action" value="">
</html:form>
<!-- till here -->
<BR><BR><BR></TD>
<TD bgcolor="#ffffff"><IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=1></TD>
</TR>
</TABLE>
<!-- Footer starts here -->

<%@ include file="/jsp/includes/footer.jsp" %>

<!-- footer end here -->

</BODY>
</HTML>
